﻿using Application.Dto;
using Application.IAppSrevices;
using AutoMapper;
using Domain.Entitys;
using Domain.Repositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.AppSrevices
{
    public class SGService : ISGService
    {
        private readonly ISGRepository sGRepository;
        private readonly IMapper mapper;

        public SGService(ISGRepository sGRepository,IMapper mapper)
        {
            this.sGRepository = sGRepository;
            this.mapper = mapper;
        }

        public List<NewSG> GetNewSG(int num)
        {
            return sGRepository.GetNewSG(num);
        }

        /// <summary>
        /// 添加薪酬发放登记信息
        /// </summary>
        /// <param name="sG"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<int> SGAddAsync(SGAddDto sGAddDto)
        {
            SG sG = mapper.Map<SG>(sGAddDto);
            return sGRepository.SGAddAsync(sG);
        }

        /// <summary>
        /// 根据薪酬编号查询对应数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<SG> SGByIdAsync(string id)
        {
            return sGRepository.SGByIdAsync(id);
        }

        /// <summary>
        /// 修改通过薪酬发放数据
        /// </summary>
        /// <param name="sGD"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<int> SGUpdateAsync(SG sG)
        {
            return sGRepository.SGUpdateAsync(sG);
        }

        /// <summary>
        /// 分页查询薪酬登记数据
        /// </summary>
        /// <param name="fenYe"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public FenYe<SG> SGSelectFnYe(FenYe<SG> fenYe)
        {
            return sGRepository.SGSelectFnYe(fenYe);
        }

        /// <summary>
        /// 多条件查询薪酬发放数据
        /// </summary>
        /// <param name="fenYe"></param>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public FenYe<SG> SGSelectWhere(FenYe<SG> fenYe, string id, string name, string startDate, string endDate)
        {
            return sGRepository.SGSelectWhere(fenYe,id,name,startDate,endDate);
        }
    }
}
